package com.autumn.zero.authorization.web.configure;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.autumn.zero.authorization.web.controllers.RoleAuthController;
import com.autumn.zero.authorization.web.controllers.UserAuthController;
import com.autumn.zero.authorization.web.controllers.UserLoginAttemptAuthController;
import com.autumn.zero.authorization.web.controllers.UserLoginLogAuthController;

/**
 * 默认授权Web配置服务
 * 
 * @author 杨昌国 2018-12-10 16:42:56
 */
@Configuration
public class AutumnDefaultZeroWebAuthorizationConfiguration {

	/**
	 * 角色授权控制器
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(RoleAuthController.class)
	public RoleAuthController autumnZeroRoleAuthController() {
		return new RoleAuthController();
	}

	/**
	 * 用户授权控制器
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(UserAuthController.class)
	public UserAuthController autumnZeroUserAuthController() {
		return new UserAuthController();
	}

	/**
	 * 登录尝试
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(UserLoginAttemptAuthController.class)
	public UserLoginAttemptAuthController autumnZeroUserLoginAttemptAuthController() {
		return new UserLoginAttemptAuthController();
	}

	/**
	 * 登录日志
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(UserLoginLogAuthController.class)
	public UserLoginLogAuthController autumnZeroUserLoginLogAuthController() {
		return new UserLoginLogAuthController();
	}
}
